﻿#pragma once

#include <QDialog>
#include "ui_SetScriptDialogUI.h"
#include "qmessagebox.h"
#include "qevent.h"
#include "QMouseEvent"

#include "ObjAutoInject.h"

#include "UI/newUI/SetScriptWaitDialog.h"
#include "UI/newUI/SetScriptLoopDialog.h"
#include  "UI/newUI/SetThermostatDialog.h"
#include  "UI/newUI/SetPositionModeDialog.h"
#include  "UI/newUI/SetRateModeDialog.h"
class ScriptRunner;

class SetScriptDialog : public QDialog,public ObjAutoInject
{
	Q_OBJECT

private://property
	Ui::SetScriptDialogUI ui;//ui类

	SetScriptWaitDialog setScriptWaitDialog;
	SetScriptLoopDialog setScriptLoopDialog;
	SetThermostatDialog setThermostatDialog;
	SetPositionModeDialog setPositionModeDialog;
	SetRateModeDialog setRateModeDialog;
private://dependency
	ScriptRunner* scriptRunner = Q_NULLPTR;

public:
	explicit SetScriptDialog(QWidget* parent = Q_NULLPTR);
	virtual ~SetScriptDialog();

signals:

public slots:
	virtual int exec()override;
	virtual void accept()override;

	//对应每个按钮
private slots:
	void slot_openSetPositionModeDialog();
	void slot_openSetRateModeDialog();
	void slot_openSetThermostatDialog();
	void slot_openSetWaitTimeDialog();
	void slot_openSetLoopDialog();
	void slot_edit();

private:
	void initSignalsAndSlots();
public:
	int getAccuracy();
	void setAccuracy(int accuracy);
	float getTurnTablePositionUpperLimit();
	void setTurnTablePositionUpperLimit(float turnTablePositionUpperLimit);
	float getTurnTablePositionLowerLimit();
	void setTurnTablePositionLowerLimit(float turnTablePositionLowerLimit);
	float getTurnTableRateUpperLimit();
	void setTurnTableRateUpperLimit(float turnTableRateUpperLimit);
	float getTurnTableRateLowerLimit();
	void setTurnTableRateLowerLimit(float turnTableRateLowerLimit);
	float getTurnTableAccelerationUpperLimit();
	void setTurnTableAccelerationUpperLimit(float  turnTableAccelerationUpperLimit);
	float getTurnTableAccelerationLowerLimit();
	void setTurnTableAccelerationLowerLimit(float turnTableAccelerationLowerLimit);
	//geter and seter
public:
	ScriptRunner* getScriptRunner();
	void setScriptRunner(ScriptRunner* scriptRunner);
public:
	virtual void objectAutoInjection(QHash<QString, QObject*>* objMap)override;
}; 

